function alertMsg(msg){
    top.alert(msg.msg);
}

let api = {
    post(url,params){
        return this.queryBody(url,params);
    },
    // body提交方式
    postBody(url,data,succ){
        if(succ == undefined){
            return new Promise((resolve,reject)=>{
                $.ajax({
                    type: "POST",
                    url: wwwurl+url,
                    headers: {
                        secret:getSecret(),
                        token:localStorage.getItem("token")
                    },
                    contentType: "application/json;charset=UTF-8",
                    dataType: "json",
                    data: JSON.stringify(data),
                    success: function (jsonResult) {
                        resolve(jsonResult);
                    }
                });
            })
        }else {
            $.ajax({
                type: "POST",
                url: wwwurl+url,
                headers: {
                    secret:getSecret(),
                    token:localStorage.getItem("token")
                },
                contentType: "application/json",
                dataType: "json",
                data: JSON.stringify(data),
                success: function (jsonResult) {
                    succ(jsonResult);
                }
            });
    }

},

    // query提交方式
    queryBody(url,params){
        return new Promise((resolve,reject)=>{
            $.ajax({
                type: "POST",
                url: wwwurl+url,
                headers: {
                    secret:getSecret(),
                    token:localStorage.getItem("token")
                },
                data: params,
                success: function (jsonResult) {
                    resolve(jsonResult);
                }
            });
        })
    },
    // 数据审核列表查询
    getAuditList(url,query, current = 1, size = 20){
        return request({
            url: url,
            method: 'post',
            data:{
                ...query,
                current,
                size
            }
        })
    },
}


// 根据指定消息编号提示信息
async function tipsMsg(ids){
    const params = {
        ids: ids
    }
    const res = await api.queryBody(
        '/admin/api/mdc/MessageDocumentController/queryForIds',
        params
    )
    if(res.code == 1){
        // Message.success(res.msg);
        return res.data;
    }else{
        top.alert(res.msg);
    }
}